<?php

$module = "";

if($_GET["module"]){
	
	$module = $_GET["module"];
}

if(@$_GET["f"]){
	
	$output = "";

	$directory_path = $_GET["f"];

	if (@$dir = opendir($directory_path)) {
		
		$output .= "<table>";

		# Read the next file
		while ((@$file = readdir($dir)) !== false) {

			if ((@$subdir = opendir($directory_path ."/". $file)) === false && $file != "." && $file != "..") {
				
				$fileExtension = strtolower(substr($file, strrpos($file, ".") + 1));
				
				if($fileExtension == "xml"){
					
					$output .= "<tr><td></td><td><a href=\"javascript:void(0)\" onclick=\"chooseFile(this,'".$directory_path ."/". $file."','".$module."')\" style=\"text-decoration:none;\">".$file."</a></td></tr>";
				}
			}
			else if(@$subdir = opendir($directory_path ."/". $file) && $file != "." && $file != ".."){
				
				$output .= "<tr><td valign=\"top\"><a href=\"javascript:void(0)\" onclick=\"openFilesDir('".$directory_path ."/". $file."','".$module."',this)\" style=\"text-decoration:none;\">+</a></td><td>".$file."<div></div></td></tr>";
			}
		}
		
		$output .= "</table>";
		
	} else {

		//addError("<p>getFiles(): could not read directory path:<code>" . $directory_path . "</code></p>", 3);
	}
	
	addContent($output);
}
	
 

?>